<!--
 * @Descripttion: 项目看板
 * @version: 
 * @Author: zhangfan
 * @email: 2207044692@qq.com
 * @Date: 2021-07-29 13:57:27
 * @LastEditors: zhangfan
 * @LastEditTime: 2021-08-03 14:51:45
-->
<template>
  <div class="conBox">
    <div class="tabs">
      <ul @click="handleClick" class="clearfix">
        <li
          v-for="(item, index) in enterpriseType"
          :key="index"
          :currentIndex="index"
          :class="activeName === index ? 'activeLi' : ''"
          style="cursor: pointer"
        >
          {{ item }}
        </li>
      </ul>
    </div>
    <div class="componentBox">
      <component v-bind:is="currentTabComponent" ref="realNameR"></component>
    </div>
  </div>
</template>

<script>
import realName from './realName'
import attManagement from './attManagement'
import accountInfo from './accountInfo'
import marginInfo from './marginInfo'
import bankbehalf from './bankbehalf'
import rightsSign from './rightsSign'
export default {
  name: 'roster',
  components: {
    realName,
    attManagement,
    accountInfo,
    marginInfo,
    bankbehalf,
    rightsSign,
  },
  data() {
    return {
      enterpriseType: [
        '实名制管理',
        '考勤管理',
        '专户信息',
        '保证金信息',
        '银行代发',
        '维权公示牌',
      ],
      activeName: 0,
      currentTabComponent: 'realName',
    }
  },
  props: {
    isFullScreen: {
      type: String,
      default: '',
    },
  },
  watch: {
    isFullScreen(newVal, oldVal) {
      if (this.activeName == 0) {
        this.$refs.realNameR.getHeight(newVal)
      }
    },
  },
  methods: {
    handleClick(e) {
      if (e.target.nodeName === 'LI') {
        this.activeName = e.target.getAttribute('currentIndex') * 1
        if (this.activeName == 0) {
          this.currentTabComponent = realName
          this.$nextTick(function () {
            this.$refs.realNameR.getHeight()
          })
        } else if (this.activeName == 1) {
          this.currentTabComponent = attManagement
        } else if (this.activeName == 2) {
          this.currentTabComponent = accountInfo
        } else if (this.activeName == 3) {
          this.currentTabComponent = marginInfo
        } else if (this.activeName == 4) {
          this.currentTabComponent = bankbehalf
        } else if (this.activeName == 5) {
          this.currentTabComponent = rightsSign
        }
      } else {
        return
      }
    },
  },
}
</script>

<style lang="less" scoped>
.conBox {
  height: 100%;
  .mainCon {
    padding-top: 0;
  }
  .topCon {
    margin-bottom: 0;
  }
  .tabs {
    text-align: center;
    padding: 8px 0px;
    ul {
      text-align: center;
      li {
        display: inline-block;
        margin-right: 5px;
        font-size: 14px;
        padding: 10px 10px;
        color: #04aff6;
        background: url('../../assets/ezTabBj.png') center center no-repeat;
        background-size: 100% 100%;
      }
      .activeLi {
        background: url('../../assets/ezSelectTab.png') center center no-repeat;
        background-size: 100% 100%;
        color: #88fcb2;
      }
    }
  }
  .componentBox {
    height: calc(100% - 55px);
  }
}
</style>
